<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>东单办公系统-修改习题</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport"
		  content="width=device-width, initial-scale=1, maximum-scale=1">
	<link rel="stylesheet" href="media/layui/css/layui.css" media="all">
</head>
<body>

<div class="layui-container" style="margin-top: 20px"><!--action="OaNew/questionupdate.do"-->
	<form class="layui-form"  method="post">
		<div class="layui-form-item">

			<label class="layui-form-label">类型</label>
			<div class="layui-input-inline">
				<select name="type" id="s1">

					<option value="基础面试">基础面试</option>
					<option value="进阶面试">进阶面试</option>
					<option value="核心算法">核心算法</option>
					<option value="底层原理">底层原理</option>
				</select>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">问题</label>
			<div class="layui-input-block">
					<textarea rows="15" cols="50" placeholder="请输入问题"
							class="layui-textarea" name="question"></textarea>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">答案</label>
			<div class="layui-input-block">
					<textarea rows="15" cols="50" placeholder="请输入答案"
							  class="layui-textarea" name="answer"></textarea>
			</div>
		</div>

		<div class="layui-form-item">
			<input style="float: right;" class="layui-btn" type="submit"
				   value="确认修改">
		</div>
	</form>
</div>


<script src="media/layui/layui.js"></script>
<script src="media/js/jquery.min.js"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
    layui.use([ 'form' ], function() {
        var form = layui.form, layer = layui.layer;

    });

	$("form").submit(function () {
		var id = window.location.search
		$.ajax({
			type:"post",
			url: "/updateQuestion" + id,
			data:$("form").serialize(),
			success: function (data) {
				if(data.code==1) {
					alert(data.msg)
					window.location.href= "/resourcelibrary.html"
				}
			},
			error:function () {
					alert("服务器错误！")
			}
			/*success:function (data) {
				console.log(data)
				//data就是后端返回的数据 {"code":1, "info":null}
				if (data.code == 1) {
					/!*window.location.href="index.html"*!/
					alert(data.info)
				} else {
					alert(data.info)
				}
			}*/
		})
	})



 /* $(function () {
  	var id = window.location.search
	  console.log(id);
	  $.ajax({
		  url: "OaNew/questionupdate.do" + id,
		  type: "get",
		  success: function (data) {
			if (data.code== 1) {
				alert(data.info)
			}
		  }
	  })
  })*/





</script>
</body>
</html>